#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define maxn 500005
int arr[maxn], t1[maxn], t2[maxn], N, M;
int lowbit(int x) { return x & -x; }
void add(int x, int k)
{ //第x个位置的元素加k
    while (x <= N)
    {
        t1[x] += k;     //t1.sum(1..j) = arr[j]
        t2[x] += x * k; //t2[i] = i*t1[i]
        x += lowbit(x);
    }
}
void add(int x, int y, int k)
{
    //x..y上的元素加k
    add(x, k), add(y + 1, -k);
}
long long getsum(int *t, int x)
{
    long long ans = 0;
    while (x >= 1)
    {
        ans += t[x];
        x -= lowbit(x);
    }
    return ans;
}
long long ask(int x)
{
    return getsum(t1, x);
}
void init()
{
    for (int i = 1, j; i <= N; ++i)
    {
        t1[i] += arr[i] - arr[i - 1];
        t2[i] += i * t1[i];
        j = i + lowbit(i);
        if (j <= N)
            t1[j] += t1[i], t2[j] += t2[i];
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin >> N >> M;
    for (int i = 1; i <= N; ++i)
        cin >> arr[i];
    init();
    for (int i = 1, a, b, c, d; i <= M; ++i)
    {
        cin >> a;
        if (a == 1)
        {
            cin >> b >> c >> d;
            add(b, c, d);
        }
        else if (a == 2)
        {
            cin >> b;
            cout << ask(b) << endl;
        }
    }
    return 0;
}